package com.meme.app;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

public class Suit2d 
{
	static { BasicConfigurator.configure (); }
	static Logger logger = Logger.getLogger (Suit2d .class);


	

	public static void main (String[] args)
	{
        SwingUtilities.invokeLater ( 
                new Runnable () 
                {
                    public void run()
                    {
                        try
                        {
                            UIManager.setLookAndFeel (UIManager.getSystemLookAndFeelClassName ());                            
                        }
                        catch (Exception e)
                        {
                            logger.warn ("Error when setting look and feel.");
                        }
                        
                        
                        Suit2dMainFrame suit2dMainFrame = new Suit2dMainFrame();
                        suit2dMainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
                		
                        suit2dMainFrame.addWindowListener 
                		(
                				new WindowAdapter ()
                				{
                			        public void windowClosing(WindowEvent e)
                			        {
                			        	Suit2dMainFrame frame = (Suit2dMainFrame) (e.getWindow());
                			        	if (frame.closeAllFileEditors ())
                			        	{
                			        		frame.dispose();
                			        		System.exit (0);
                			        	}
                			        }
                				}
                		);
                		
                        suit2dMainFrame.pack();
                        int screenWidth  = Toolkit.getDefaultToolkit().getScreenSize().width;
                        int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
                        int selfWidth  = suit2dMainFrame.getSize().width;
                        int selfHeight = suit2dMainFrame.getSize().height;
                        suit2dMainFrame.setLocation ((screenWidth - selfWidth) / 2, (screenHeight - selfHeight) / 2);
                        suit2dMainFrame.setVisible(true);
                    }
                }
            );		


	}
}
